
function init(){
	initForm();
}

function initForm(){
	var getSubSysUrl = System.getRootPath()+"/console.selSubSys.do";
	System.ajaxGet(getSubSysUrl, function(data){
		$.each(data.rows,function(i,row){
			var optionStr = "<option value='"+row.subSys+"'>"+row.sysDesc+"</option>";
			$("select[name='subSys']").append(optionStr);
		})
	}, false);
	top.$.messager.progress('close');
}

function selTabls(){
	var subSys = $("select[name='subSys']").val();
	if(!subSys){
		System.showError('错误', "请选择子系统！");
		return;
	}
	var getSelTablsUrl = System.getRootPath()+"/console.selTabls.do?subSys="+subSys;
	System.ajaxGet(getSelTablsUrl, function(data){
		$("select[name='allTblsObj']").empty();
		$.each(data.rows,function(i,row){
			var showName = row.tableName;
			if(row.remarks){
				showName = showName + "-" + row.remarks;
			}
			var optionStr = "<option value='"+row.tableName+"'>"+showName+"</option>";
			$("select[name='allTblsObj']").append(optionStr);
		})
	}, false);
}

function nextStep(){
	if($("input[name='selType']:checked").val()=='input'){
	}else{
		var subSys = $("select[name='subSys']").val();
		if(!subSys){
			System.showError('错误', "请选择子系统！");
			return;
		}
		var options = $("select[name='selTblsObj'] option:selected");
		if(options.length==0){
			System.showError('错误', "请选择数据表！");
			return;
		}
		var selTbls="";
		for(i=0;i<options.length;i++){
			var option = options[i];
			var val = $(option).val();
			selTbls+=(selTbls==""?"":",")+val;
		}
		var buildTablUrl = System.getRootPath()+"/console.buildTabls.do";
		var parameter = "subSys="+subSys+"&selTbls="+selTbls;
		System.ajaxPost(buildTablUrl, parameter);
		
	}
}
